#include<bits/stdc++.h>
#define int long long
#define maxn 100100

using namespace std;

int n;
int r[maxn];
int a[maxn],idx,last;
int cnt[maxn];
int ans;

bool cmp(int x,int y){
    return x>y;
}

signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>r[i];
    sort(r+1,r+n+1,cmp);
    for(int i=1;i<=n;i++){
        if(i==1) a[++idx]=r[i],last=1;
        else if(i==n){
            if(r[i]!=r[i-1]) a[++idx]=r[i],cnt[idx]=1;
            else cnt[idx]=++last;
        }
        else if(r[i]!=r[i-1]){
            a[++idx]=r[i];
            cnt[idx-1]=last;
            last=1;
        }
        else last++;
    }
    ans=n;
    for(int i=idx;i>=2;i--){
        int res=cnt[i];
        if(ans-res>=res) ans-=res;
        else{
            int b=ans-res;
            ans-=b;
            break;
        }
    }
    cout<<ans<<"\n";
    return 0;
}